package com.theanh.RssActivity.entity;

import java.util.ArrayList;
import java.util.List;

import com.theanh.RssActivity.util.StringUtils;

public class Category {
	
	private int id;
	private String name;
	private int iconID;
	
	public List<Channel> channels;
	
	public Category(){
		this.channels = new ArrayList<Channel>();
	}
	
	public Category(int id, String name){
		this.id = id;
		this.name = name;
		
		this.channels = new ArrayList<Channel>();
	}
	
	public void addChannel(Channel channel){
		this.channels.add(channel);
	}
	
	public void removeChannel(Channel channel){
		this.channels.remove(channel);
	}
	
	public Channel removeChannel(int location){
		return this.channels.remove(location);
	}
	
	public int getID(){
		return id;
	}
	
	public String getName(){
		return name;
	}
	
	public List<Channel> getChannel(){
		return channels;
	}
	
	public void setID(int id){
		this.id = id;
	}
	
	public void setName(String name){
		this.name = name;
	}
	
	public String toString(){
		return "ID=" + id +", Name=" + name;
	}

	public int getIconID() {
		return iconID;
	}

	public void setIconID(int iconID) {
		this.iconID = iconID;
	}
	
	public boolean validate() {
		if (StringUtils.isNullOrEmpty(name)) {
			return false;
		}
		return true;
	}
}
